package com.euro.video.phone.services;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.euro.video.phone.dao.PubliciteDao;
import com.euro.video.phone.entities.Publicite;

@Service
public class PubliciteService {
	@Autowired
	private PubliciteDao publiciteDao;
	
	public Publicite creer(Publicite publicite) throws Exception {
		return publiciteDao.creerPublicite(publicite);
	}
	
	public Publicite lire(String titre) throws Exception {
		return publiciteDao.lirePublicite(titre);
	}
	
	public Publicite modifier(Publicite publicite) throws Exception {
		return publiciteDao.modifierPublicite(publicite);
	}
	
	public boolean supprimer(Publicite publicite) throws Exception {
		return publiciteDao.supprimerPublicite(publicite);
	}
	
	public List<Publicite> listPublicitesALaUne() throws Exception {
		return publiciteDao.listPublicitesALaUne();
	}
	
	public List<Publicite> listPublicitesParDates(Date debut, Date fin) throws Exception {
		return publiciteDao.listPublicitesParDates(debut, fin);
	}
	
	public byte[] getImage(String titre) throws Exception {
		return publiciteDao.retrouverImage(titre);
	}
}
